# 导入PstGIS函数
   from psycopg2.extensions import AsIs

   # 创建密度图表
   cursor.execute("CREATE TABLE density (id int PRIMARY KEY, raster raster, geom geometry(Point, 4326))")

   # 在密度图表中插入数据
   cursor.execute("INSERT INTO density VALUES (%s, ST_AsRaster(ST_MakePoint(%s, %s), 0.1, 0.1), ST_MakePoint(%s, %s))", (1, 110, 30, 110, 30))

   # 对密度图进行查询
   cursor.execute("SELECT id FROM density WHERE ST_ValueCount(raster) = 1 AND ST_Value(raster, 1, ST_SetSRID(ST_MakePoint(%s, %s), 4326)) > %s", (110, 30, 0.5))

